/*
 * @Description: 文件合并按钮
 * @Author: Zzt
 * @Date: 2022-10-29 11:30:30
 * @LastEditTime: 2022-11-02 16:46:34
 */
import { Button } from 'antd';
import { useMemo, useState } from 'react';
import { useLevelTableContext } from '../../contexts/LevelTableContext';
import MergeDialog from '../dialogs/MergeDialog';

const FileMerge = (props: any) => {
  const { selectItems, baseInfo } = props;
  const [visible, setVisible] = useState(false);
  const { list } = useLevelTableContext();

  return (
    <>
      <Button
        type="text"
        size="small"
        onClick={() => setVisible(true)}
        disabled={selectItems.length < 2}
      >
        文件合并
      </Button>
      {useMemo(
        () => (
          <MergeDialog
            visible={visible}
            outIn={list}
            selectItems={selectItems}
            baseInfo={baseInfo}
            // query={baseInfo.param}
            // info={upperInfo}
            onClose={() => {
              setVisible(false);
            }}
          />
        ),
        [visible]
      )}
    </>
  );
};
export default FileMerge;
